<!DOCTYPE html>
<html ng-app="ngMap">
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<script src="script-tags-for-development.js"></script>
<script>
  angular.module('ngMap').controller('MyCtrl', function($timeout, NgMap) {
    var vm = this;
    
    vm.stores = {
      foo: { position:[41, -87], items: [1,2,3,4]},
      bar:{ position:[41, -83], items: [5,6,7,8]}
    };
    
    vm.initMap = function(mapId) {
      vm.map = NgMap.initMap(mapId);
      console.log('vm.map 2', vm.map)
    }
    
    vm.showStore = function(evt, storeId) {
      vm.store = vm.stores[storeId];
      console.log('vm.map', vm.map)
      vm.map.showInfoWindow('bar', this);
    };
  });
</script>
</head>

<body ng-controller="MyCtrl as vm">
  <div style="position:relavtive">
    <ng-map id="foo" default-style="true" lazy-init="true"
      center="{{vm.stores.foo.position[0]}}, {{vm.stores.foo.position[1]}}" zoom="3">
      
      <marker ng-repeat="(id, store) in vm.stores" id="{{id}}"
        position="{{store.position}}"
        on-click="vm.showStore(event, id)"></marker>
      
      <info-window id="bar">
        <div ng-non-bindable="">
          Lat: {{anchor.getPosition().lat()}}<br/>
          Lng: {{anchor.getPosition().lng()}}<br/>
          <ul>
            <li ng-repeat='item in store.items'>{{item}}</li>
          </ul>
        </div>
      </info-window>
    </ng-map>
  </div>
  <button ng-click="vm.initMap('foo')">Init Map</button>
</body>
</html>
